//
//  NYUpdateUserInfoViewController.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2017/11/5.
//  Copyright © 2017年 niuwaketang. All rights reserved.
//

#import "NYUpdateUserInfoViewController.h"
#import "NYUploadImageRequest.h"
#import "NYImagePickerViewController.h"
#import "NYUpdateUserInfoForm.h"
@interface NYUpdateUserInfoViewController ()
@property(nonatomic, strong) NYUploadImageRequest *uploadImgRequest;
@end

@implementation NYUpdateUserInfoViewController
- (void)viewDidLoad
{
        self.form = [NYUpdateUserInfoForm formDescriptorWithTitle:@"编辑个人资料"];
        [super viewDidLoad];
}
- (void)initTableView
{
        [super initTableView];
        self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        self.tableView.backgroundColor = UIColorHex(0xf5f5f5);

}
- (void)presentOrPushInViewController:(UIViewController *)viewController dismiss:(void (^)(void))dismiss
{
        self.dismissBlock = dismiss;
        
        if (viewController.navigationController)
        {
                if ([viewController.navigationController.viewControllers.lastObject isKindOfClass:[NYUpdateUserInfoViewController class]]) {
                        return;
                }
                [viewController.navigationController pushViewController:self animated:YES];
        }
        else
        {
                if ([viewController.presentedViewController isKindOfClass:[BaseNavigationViewController class]])
                {
                        BOOL res = [[(BaseNavigationViewController *)viewController.presentedViewController viewControllers].lastObject isKindOfClass:[NYUpdateUserInfoViewController class]];
                        if (res)
                        {
                                return;
                        }
                }
                BaseNavigationViewController *nav = [[BaseNavigationViewController alloc] initWithRootViewController:self];
                [viewController presentViewController:nav animated:YES completion:nil];
        }
}
- (void)backButtonDidClick:(UIButton *)button
{
        if (self.navigationController.viewControllers.lastObject == self && self.popupController) {
                [self.navigationController dismissViewControllerAnimated:YES completion:self.dismissBlock];
        } else {
                [super backButtonDidClick:button];
        }
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
        if (section == 1) {
                return __WGHeight(11);
        }
        return CGFLOAT_MIN;
}
+ (UIViewController<JLRRouteDefinitionTargetController> *)targetControllerWithParams:(NSDictionary *)parameters
{
        return [[NYUpdateUserInfoViewController alloc] init];
}
@end
